package edu.ncst.baseweb.controller.resinfo;

import cn.wintersun.basecommon.common.Result;
import edu.ncst.baseweb.dao.res.ResRecord;
import edu.ncst.baseweb.service.intrer.resinfo.ResRecordService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/booked/bookedrecord")
@PreAuthorize("hasAuthority('7')")
//用户预约记录
public class ResRecordController {
    @Autowired
    private ResRecordService resRecordService;
    //用户界面 预约记录查看
    @RequestMapping(value = "list",method = RequestMethod.POST)
    public Result<IPage<ResRecord>> list(@RequestBody ResRecord resRecord){

        return  resRecordService.list(resRecord);
    }
    //取消预约
    @RequestMapping(value="cancebook",method=RequestMethod.POST)
    public Result<Object> cancebook(@RequestBody ResRecord resRecord){
        try {
            return  resRecordService.cancebook(resRecord);
        } catch (Exception e) {
            return Result.failure(500, e.getMessage());
        }
    }


}

